/*
 * @Description: 机构管理-接口
 * @Date: 2023-11-16 14:14:42
 * @FilePath: \hk-computerRoom-Security\src\api\configuration\organization\index.ts
 */
import request from '/@/utils/request';

/**
 * @method addOrganization 新增
 * @method delOrganization 删除
 * @method updateOrganization 修改
 * @method queryServerListByPaging 分页查询
 * @method queryOrganizationById 单个查询
 */
export function useOrganizationApi() {
  return {
    addOrganization: (params: object) => {
      return request({
        url: '/api/mqtt/organization/addOrganization',
        method: 'POST',
        data: params,
      });
    },
    delOrganization: (id: string) => {
      return request({
        url: `/api/mqtt/organization/delOrganization/${id}`,
        method: 'DELETE',
      });
    },
    updateOrganization: (params: object) => {
      return request({
        url: '/api/mqtt/organization/updateOrganization',
        method: 'PUT',
        data: params,
      });
    },
    // 分页查询机构列表
    queryServerListByPaging: (params: object) => {
      return request({
        url: '/api/mqtt/organization/queryServerListByPaging',
        method: 'POST',
        data: params,
      });
    },
    queryOrganizationById: (id: any) => {
      return request({
        url: `/api/mqtt/organization/queryOrganizationById/${id}`,
        method: 'GET',
      });
    },

    // 查询地区树
    generateRegionTree: () => {
      return request({
        url: `/api/mqtt/cityRegion/generateRegionTree`,
        method: 'GET',
      });
    },

    // 根据机构id查询报警联络人列表
    queryAlarmContactsByOrganizationId: () => {
      return request({
        url: '/api/mqtt/alarmContacts/queryAlarmContactsByOrganizationId',
        method: 'POST',
        // data: { id },
        // headers: {
        //   'Content-Type': 'multipart/form-data'
        // }
      });
    },
    // 根据id查询报警联络人详细信息
    queryAlarmContactsById: (id: any) => {
      return request({
        url: `/api/mqtt/alarmContacts/queryAlarmContactsById/${id}`,
        method: 'GET',
      });
    },
    // 新增报警联络人
    addAlarmContacts: (params: object) => {
      return request({
        url: '/api/mqtt/alarmContacts/addAlarmContacts',
        method: 'POST',
        data: params,
      });
    },
    // 删除报警联络人
    delAlarmContacts: (id: string) => {
      return request({
        url: `/api/mqtt/alarmContacts/delAlarmContacts/${id}`,
        method: 'DELETE',
      });
    },
    // 修改报警联络人
    updateAlarmContacts: (params: object) => {
      return request({
        url: '/api/mqtt/alarmContacts/updateAlarmContacts',
        method: 'PUT',
        data: params,
      });
    },

    // 新增机构历史/告警数据留存
    addDataRetentionSettings: (params: object) => {
      return request({
        url: '/api/mqtt/dataRetentionSettings/addDataRetentionSettings',
        method: 'POST',
        data: params,
      });
    },
    // 删除机构历史/告警数据留存
    delDataRetentionSettings: (id: string) => {
      return request({
        url: `/api/mqtt/dataRetentionSettings/delDataRetentionSettings/${id}`,
        method: 'DELETE',
      });
    },
    // 修改机构历史/告警数据留存
    updateDataRetentionSettings: (params: object) => {
      return request({
        url: '/api/mqtt/dataRetentionSettings/updateDataRetentionSettings',
        method: 'PUT',
        data: params,
      });
    },
    // 根据机构id查询机构历史/告警数据留存列表
    queryDataRetentionSettingsByOrganizationId: () => {
      return request({
        url: '/api/mqtt/dataRetentionSettings/queryDataRetentionSettingsByOrganizationId',
        method: 'POST',
        // data: { id },
        // headers: {
        //   'Content-Type': 'multipart/form-data'
        // }
      });
    },
    // 根据id查询机构历史/告警数据留存详细信息
    queryDataRetentionSettingsById: (id: any) => {
      return request({
        url: `/api/mqtt/dataRetentionSettings/queryDataRetentionSettingsById/${id}`,
        method: 'GET',
      });
    },
  };
}
